﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Claims.aspx.cs" Inherits="Claims_Test" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <telerik:RadAjaxPanel runat="server" LoadingPanelID="RadAjaxLoadingPanel1" 
    ID="RadPnlMain" ForeColor="Black" Width="1200px">
    
    
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGridClaims">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridClaims" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
        Width="75px">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0px;" />
    </telerik:RadAjaxLoadingPanel>
    
        <telerik:RadGrid ID="RadGridClaims" runat="server" AllowPaging="True" AutoGenerateColumns="false"
        DataSourceID="ldsClaims" GridLines="None"
        AllowAutomaticInserts="true" AllowAutomaticDeletes="true" 
            AllowAutomaticUpdates="true" 
            onselectedindexchanged="RadGridClaims_SelectedIndexChanged" 
            Font-Size="Larger">
        <HeaderContextMenu EnableTheming="True">
            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
        </HeaderContextMenu>
        
            <MasterTableView DataSourceID="ldsClaims" AutoGenerateColumns="false" EditFormSettings-EditColumn-ButtonType="ImageButton"
            EditFormSettings-EditColumn-CancelText="Прекрати" EditFormSettings-EditColumn-UpdateText="Обнови"
            DataKeyNames="ClaimId" Caption="Оплаквания" EditFormSettings-EditColumn-InsertText="Въведи"
            EditMode="EditForms" AllowPaging="true" PagerStyle-Mode="NextPrevAndNumeric"
            CommandItemDisplay="Top" CommandItemSettings-RefreshText="Обнови" CommandItemSettings-AddNewRecordText="Добави нов запис"
            EditFormSettings-ColumnNumber="3" Name="Claims" >
            <CommandItemSettings AddNewRecordText="Добави нов запис" RefreshText="Обнови" />
            
                <DetailTables>
                
                <telerik:GridTableView Caption="Отказани артикули" AllowSorting="false" DataKeyNames="Id" AllowAutomaticDeletes="true" AllowAutomaticInserts="true"  
                    Name="RejectedItems" DataSourceID="ldsRejectedItems" CommandItemDisplay="Top" EditFormSettings-EditColumn-ButtonType="ImageButton"
                    EditFormSettings-EditColumn-CancelText="Прекрати" EditFormSettings-EditColumn-UpdateText="Обнови"
                    EditFormSettings-EditColumn-InsertText="Въведи" CommandItemSettings-AddNewRecordText="Добави артикул"
                    CommandItemSettings-RefreshText="Обнови" Width="90%" >
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="ClaimId" MasterKeyField="ClaimId" />
                    </ParentTableRelation>
                    <CommandItemSettings AddNewRecordText="Добави артикул" RefreshText="Обнови"></CommandItemSettings>
                    <RowIndicatorColumn>
                        <HeaderStyle Width="30px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="30px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                   
                        <telerik:GridBoundColumn DataField="ItemCode" HeaderText="ItemCode" 
                        SortExpression="ItemCode" UniqueName="ItemCode">
                        </telerik:GridBoundColumn>
                        
                        <%--<telerik:GridBoundColumn DataField="ItemName" HeaderText="ItemName" 
                        SortExpression="ItemName" UniqueName="ItemName">
                        </telerik:GridBoundColumn>--%>
                        
                        <telerik:GridBoundColumn DataField="ItemDescription" 
                        HeaderText="ItemDescription" SortExpression="ItemDescription" 
                        UniqueName="ItemDescription">
                        </telerik:GridBoundColumn>
                        
                        <telerik:GridNumericColumn DataField="ReceivedQuantity" DataType="System.Int32" 
                        HeaderText="ReceivedQuantity" SortExpression="ReceivedQuantity" 
                        UniqueName="ReceivedQuantity">
                        </telerik:GridNumericColumn>
                        
                        <telerik:GridNumericColumn DataField="ApprovedQuantity" DataType="System.Int32" 
                        HeaderText="ApprovedQuantity" SortExpression="ApprovedQuantity" 
                        UniqueName="ApprovedQuantity">
                        </telerik:GridNumericColumn>
                        
                        <telerik:GridBoundColumn DataField="RejectedQuantity" DataType="System.Int32" 
                        HeaderText="RejectedQuantity" SortExpression="RejectedQuantity" 
                        UniqueName="RejectedQuantity">
                        </telerik:GridBoundColumn>
                        
                        <telerik:GridNumericColumn DataField="ExtraWork" DataType="System.Int32" 
                        HeaderText="ExtraWork" SortExpression="ExtraWork" 
                        UniqueName="ExtraWork">
                        </telerik:GridNumericColumn>
                                             
                        <telerik:GridDropDownColumn DataField="Status" HeaderText="Status" 
                        UniqueName="Status" DataSourceID="ldsStatus" ListTextField="status1"
                        ListValueField="id">
                        </telerik:GridDropDownColumn>
                        
                        <telerik:GridNumericColumn DataField="Price" DataType="System.Int32" 
                        HeaderText="Price" SortExpression="Price" 
                        UniqueName="Price">
                        </telerik:GridNumericColumn>
                        
                        <telerik:GridNumericColumn DataField="QualityInspCost" DataType="System.Int32" 
                        HeaderText="QualityInspCost" SortExpression="QualityInspCost" 
                        UniqueName="QualityInspCost">
                        </telerik:GridNumericColumn>
                        
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Изтрий"
                            HeaderText="Изтрий" UniqueName="columnDelete" ConfirmText="Сигурни ли сте, че искате да изтриете записа?"
                            ItemStyle-Width="10%">
                            <ItemStyle Width="10%"></ItemStyle>
                        </telerik:GridButtonColumn>
                        
                    </Columns>
                    <EditFormSettings>
                        <EditColumn ButtonType="ImageButton" CancelText="Прекрати" UpdateText="Обнови" InsertText="Въведи">
                        </EditColumn>
                    </EditFormSettings>
                </telerik:GridTableView>
                
            </DetailTables>
            
            <Columns>
                <telerik:GridButtonColumn UniqueName="Select" ButtonType="LinkButton"
                 CommandName="Select" Text="Преглед">
                </telerik:GridButtonColumn>
        
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" Text="Редактирай"
                    UniqueName="Edit">
                </telerik:GridButtonColumn>
                     
                <telerik:GridDropDownColumn UniqueName="CustomerId" DataSourceID="ldsCustomers"
                ListTextField="Name" ListValueField="CustomerId" HeaderText="Клиент" DataField="CustomerId">
                </telerik:GridDropDownColumn>
                
                <telerik:GridDropDownColumn UniqueName="SupplierId" DataSourceID="ldsSuppliers"
                ListTextField="Name" ListValueField="SupplierId" HeaderText="Доставчик" DataField="SupplierID">
                </telerik:GridDropDownColumn>
                
                <telerik:GridDateTimeColumn UniqueName="ArrivalDate" DataField="ArrivalDate" DataType="System.DateTime"
                HeaderText="Дата пристигане" SortExpression="ArrivalDate" DataFormatString="{0:MM/dd/yy}">
                </telerik:GridDateTimeColumn>
                
                <telerik:GridDateTimeColumn UniqueName="ClaimNoteDate" DataField="ClaimNoteDate" DataType="System.DateTime"
                HeaderText="Дата на оплакването" SortExpression="ClaimNoteDate" DataFormatString="{0:MM/dd/yy}">
                </telerik:GridDateTimeColumn>
                                       
                <telerik:GridDropDownColumn DataSourceID="ldsRequestedAction" DataField="RequestedActionId"
                HeaderText="Искано действие" SortExpression="RequestedActionId" ListTextField="Text" ListValueField="RequestedActionId">
                </telerik:GridDropDownColumn>
                
                <telerik:GridBoundColumn UniqueName="OtherAction" HeaderText="Други действия"
                SortExpression="OtherAction" DataField="OtherAction">
                </telerik:GridBoundColumn>
                
                <telerik:GridDropDownColumn DataField="ReferenceId" HeaderText="ReferenceId"  UniqueName="ReferenceId"               
                DataSourceID="ldsReferences" ListValueField="ReferenceId" ListTextField="ReferenceName">
                </telerik:GridDropDownColumn>
                
                 <telerik:GridBoundColumn DataField="DelyNote" HeaderText="DelyNote" 
                SortExpression="DelyNote" UniqueName="DelyNote">
                </telerik:GridBoundColumn>
                
                <telerik:GridBoundColumn DataField="ClaimNum" HeaderText="ClaimNum" 
                SortExpression="ClaimNum" UniqueName="ClaimNum">
                </telerik:GridBoundColumn>
                
                <telerik:GridBoundColumn DataField="Supplier" HeaderText="Supplier" 
                SortExpression="Supplier" UniqueName="Supplier">
                </telerik:GridBoundColumn>
                                             
                <telerik:GridBoundColumn DataField="OrderNum" HeaderText="OrderNum" 
                SortExpression="OrderNum" UniqueName="OrderNum">
                </telerik:GridBoundColumn>
                
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Изтрий"
                UniqueName="columnDelete" ConfirmText="Сигурни ли сте, че искате да изтриете записа?">
                </telerik:GridButtonColumn>
                
            </Columns>
            <EditFormSettings ColumnNumber="2">
                  <EditColumn ButtonType="ImageButton" CancelText="Прекрати" UpdateText="Обнови" InsertText="Въведи">
                  </EditColumn>
            </EditFormSettings>
                
            <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>           
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            
            
            </MasterTableView>
            <FilterMenu EnableTheming="True">
                <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
            </FilterMenu>
          
    </telerik:RadGrid>
    
    
    </telerik:RadAjaxPanel>



<%--Data sources:--%>
    <asp:LinqDataSource ID="ldsClaims" runat="server" 
        ContextTypeName="ItemsDataContext" EnableUpdate="True" TableName="Claims" 
        EnableDelete="True" EnableInsert="True">
    </asp:LinqDataSource>
    
    
    
    <asp:LinqDataSource ID="ldsCustomers" runat="server" 
        ContextTypeName="ItemsDataContext" Select="new (Name, CustomerID)" 
        TableName="Customers">
    </asp:LinqDataSource>
             
    <asp:LinqDataSource ID="ldsSuppliers" runat="server" 
                ContextTypeName="ItemsDataContext" Select="new (Name, SupplierID)" 
                TableName="Suppliers">
        </asp:LinqDataSource>
             
    <asp:LinqDataSource ID="ldsReferences" runat="server" 
            ContextTypeName="ItemsDataContext" Select="new (ReferenceId, ReferenceName)" 
            TableName="References">
        </asp:LinqDataSource>
    
    
    <asp:LinqDataSource ID="ldsRequestedAction" runat="server" 
            ContextTypeName="ItemsDataContext" Select="new (RequestedActionId, Text)" 
            TableName="RequestedActions">
    </asp:LinqDataSource>
    
    <asp:LinqDataSource ID="ldsStatus" runat="server" 
            ContextTypeName="ItemsDataContext" Select="new (status1, id)" 
            TableName="Status">
        </asp:LinqDataSource>

    <asp:LinqDataSource ID="ldsRejectedItems" runat="server" 
        ContextTypeName="ItemsDataContext" EnableDelete="True" EnableInsert="True" 
        EnableUpdate="True" TableName="RejectedItems" 
        oninserted="ldsRejectedItems_Inserted" oninserting="ldsRejectedItems_Inserting">
    </asp:LinqDataSource>

</asp:Content>





